package com.xmkj.bearbiz.home;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.Priority;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.common.banner.Holder;
import com.xmkj.bearbiz.R;


public class NetworkImageHolderView implements Holder<String> {

    private ImageView imageView;

    @Override
    public View createView(Context context) {
        imageView = new ImageView(context);
        imageView.setScaleType(ImageView.ScaleType.FIT_XY);
        return imageView;
    }

    @Override
    public void UpdateUI(Context context, int position, String data) {

     /*   Glide.with(context)
                .load(data)
                .thumbnail(0.2f)
                .placeholder(R.drawable.blank_pic)
                .into(imageView);*/

        RequestOptions options = new RequestOptions()
                .centerCrop()
                .diskCacheStrategy(DiskCacheStrategy.ALL)
                .placeholder(R.mipmap.blank_pic)
                .error(R.mipmap.blank_pic)
                .priority(Priority.HIGH);
        Glide.with(imageView.getContext()).load(data).apply(options).into(imageView);
    }
}
